package cn.com.xf.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.com.xf.dao.TblCheckFpDAO;
import cn.com.xf.dao.TblCheckUserDAO;
import cn.com.xf.domain.TblCheckFp;
import cn.com.xf.domain.TblCheckUser;
import cn.com.xf.service.CheckUserService;

@Service
public class CheckUserServiceImpl implements CheckUserService {

	@Autowired
	private TblCheckUserDAO tblCheckUserDAO;
	
	@Autowired
	private TblCheckFpDAO tblCheckFpDAO;
	
	@Override
	public List<TblCheckUser> selectUsers(int begin, int pageSize, String sn, String userid) {
		return tblCheckUserDAO.selectUsers(begin, pageSize, sn, userid);
	}

	@Override
	public int selectUserCount(String sn, String userid) {
		return tblCheckUserDAO.selectCount(sn, userid);
	}

	@Override
	public int deleteUser(Long id) {
//		TblCheckUser user = tblCheckUserDAO.selectByPrimaryKey(id);
//		user.setStatus((short) -1);
//		return tblCheckUserDAO.updateByPrimaryKeySelective(user);
		return tblCheckUserDAO.deleteByPrimaryKey(id);
	}

	@Override
	public TblCheckUser selectUser(Long id) {
		return tblCheckUserDAO.selectByPrimaryKey(id);
	}

	@Override
	public int insertBatch(List<TblCheckUser> users) {
		return tblCheckUserDAO.insertBatch(users);
	}

	@Override
	public TblCheckUser selectUser(String sn, String userid) {
		List<TblCheckUser> list = tblCheckUserDAO.selectUser(sn, userid);
		if (list != null && list.size() > 0) {
			return list.get(0);
		}
		return null;
	}

	@Override
	public List<TblCheckFp> selectFp(String userid) {
		return tblCheckFpDAO.selectFp(userid);
	}

}
